export const DefaultOptionAll = { label: '全部', value: '', key: '-999999' };
export const DefaultOptionEmpty = { label: '', value: '', key: '-999998' };
export const DefaultPingUrl = 'http://##HOST##:8000';
export const DefaultMeasureUrl = 'http://show.listgoogle.com:8000';
export const DefaultCdnPingUrl = 'https://##HOST##/ping';

export const getObjectOptions = (srcObj: object, includeAll: boolean) => {
  if (srcObj == null) {
    return [];
  }
  let options = [];
  if (includeAll === true) {
    options.push(DefaultOptionAll);
  }

  for (let [_, item] of Object.entries(srcObj)) {
    options.push(item);
  }

  return options;
};

export const getObjectItem = (srcObj: object, val?: any) => {
  if (srcObj == null || val == null) {
    return '';
  }

  for (let [_, item] of Object.entries(srcObj)) {
    if (item.value.toString() == val.toString()) {
      return item;
    }
  }

  return null;
};

export const getObjectText = (srcObj: object, val?: any) => {
  if (srcObj == null || val == null) {
    return '';
  }

  for (let [_, item] of Object.entries(srcObj)) {
    if (item.value.toString() == val.toString()) {
      return item.label;
    }
  }

  return '';
};

//VpnGroup分配方式
export const VpnGroupAllotMode = {
  FixedIp: { label: '固定IP', value: 2 },
  FixedUser: { label: '绑定用户', value: 3 },
};

export const VpnGroupAllotModeOptions = [
  { label: ' ', value: 0 },
  VpnGroupAllotMode.FixedIp,
  VpnGroupAllotMode.FixedUser,
];

export const getVpnGroupAllotModeText = (val?: number) => {
  return getObjectText(VpnGroupAllotMode, val);
};

//注册方式
export const RegistMode = {
  Auto: { label: '自动', value: '1' },
  Manual: { label: '注册', value: '2' },
  Buy: { label: '购买', value: '3' },
  Gen: { label: '生成', value: '4' },
};

export const getRegistModeText = (val?: string) => {
  var text = getObjectText(RegistMode, val);
  if (text == RegistMode.Auto.label) {
    return '';
  }
  return text;
};

export const TickctStatus = {
  Open: 0,
  Processing: 1,
  Close: 2,
};

export const TickctStatusOptions = [
  {
    label: '待处理',
    value: 0,
  },
  {
    label: '处理中',
    value: 1,
  },
  {
    label: '关闭',
    value: 2,
  },
];

//产品支持的语言
export const Langs = [
  {
    label: '英文',
    value: 'en',
  },
  {
    label: '中文简体',
    value: 'zh-cn',
  },
  {
    label: '中文繁体',
    value: 'zh-tw',
  },
];

export const getLang = (value?: string) => {
  if (!value || value == '') {
    return undefined;
  }
  for (let item of Langs) {
    if (item.value === value) {
      return item;
    }
  }

  return undefined;
};

//标签类型
export const TagType = {
  VpnGroup: { label: '分组标签', value: 'vpngroup' },
  GhostVpnGroup: { label: '幽灵分组标签', value: 'ghostvpngroup' },
};

export const TagTypeOptions = [TagType.VpnGroup, TagType.GhostVpnGroup];

export const getTagTypeText = (val?: string) => {
  return getObjectText(TagType, val);
};

//分组类型
export const VpnGroupType = {
  Normal: { label: 'Normal', value: 0 },
  Ghost: { label: 'Ghost', value: 1 },
  Private: { label: 'Private', value: 2 },
  Stream: { label: 'Stream', value: 3 },
};

export const VpnGroupTypeOptions = [
  VpnGroupType.Normal,
  VpnGroupType.Ghost,
  VpnGroupType.Stream,
  VpnGroupType.Private,
];

export const getVpnGroupTypeText = (val?: number) => {
  return getObjectText(VpnGroupType, val);
};

//分组地区显示策略
export const GroupDisplayAreaFilterPolicy = {
  Display: { label: '仅选中地区显示', value: 'display' },
  Hidden: { label: '仅选中地区隐藏', value: 'hidden' },
};

export const GroupDisplayAreaFilterPolicyOptions = [
  { label: '', value: '' },
  GroupDisplayAreaFilterPolicy.Display,
  GroupDisplayAreaFilterPolicy.Hidden,
];

export const getGroupDisplayAreaFilterPolicyText = (val?: string) => {
  return getObjectText(GroupDisplayAreaFilterPolicy, val);
};

//分组用户显示策略
export const GroupDisplayUserPolicy = {
  Display: { label: '指定用户显示', value: 'display' },
  Hidden: { label: '指定用户隐藏', value: 'hidden' },
};

export const GroupDisplayUserPolicyOptions = [
  { label: '', value: '' },
  GroupDisplayUserPolicy.Display,
  GroupDisplayUserPolicy.Hidden,
];

export const getGroupDisplayUserPolicyText = (val?: string) => {
  return getObjectText(GroupDisplayUserPolicy, val);
};

//版本比较策略
export const AppVerCompare = {
  Equals: { label: '等于', value: '=' },
  GreaterThan: { label: '大于', value: '>' },
  GreaterThanOrEqual: { label: '大于等于', value: '>=' },
  LessThan: { label: '小于', value: '<' },
  LessThanOrEqual: { label: '小于等于', value: '<=' },
};

export const getAppVerCompareText = (val?: string) => {
  return getObjectText(AppVerCompare, val);
};

export const GroupDisplayAppVerCompareOptions = [
  { label: '', value: '' },
  AppVerCompare.Equals,
  AppVerCompare.GreaterThan,
  AppVerCompare.GreaterThanOrEqual,
  AppVerCompare.LessThan,
  AppVerCompare.LessThanOrEqual,
];

//注册比较策略
export const RegistCompareMode = {
  GreaterThan: { label: '前', value: '>' },
  LessThanOrEqual: { label: '内', value: '<=' },
};

export const getRegistCompareModeText = (val?: string) => {
  return getObjectText(RegistCompareMode, val);
};

export const GroupDisplayUserRegistCompareOptions = [
  { label: '', value: '' },
  RegistCompareMode.GreaterThan,
  RegistCompareMode.LessThanOrEqual,
];

export const UpgradePackagePolicyAppVerCompareOptions = [
  { label: '', value: '' },
  AppVerCompare.Equals,
  AppVerCompare.LessThan,
  AppVerCompare.LessThanOrEqual,
];

//会员等级
export const MemberLevel = {
  Trial: { label: '试用', value: 0, key: 0 },
  Free: { label: '免费', value: 1, key: 1 },
  VIP: { label: '会员', value: 2, key: 2 },
  Internal: { label: '内部', value: 9999, key: 9999 },
};

export const MemberLevelOptions = [
  MemberLevel.Trial,
  MemberLevel.Free,
  MemberLevel.VIP,
  MemberLevel.Internal,
];

export const getMemberLevelText = (val?: number) => {
  return getObjectText(MemberLevel, val);
};

//订单状态
export const OrderStatus = {
  Create: { label: '待支付', value: 0 },
  Paid: { label: '已支付', value: 1 },
  Completed: { label: '已完成', value: 2 },
  Canceled: { label: '已取消', value: -1 },
};

export const OrderStatusOptions = [
  OrderStatus.Create,
  OrderStatus.Paid,
  OrderStatus.Completed,
  OrderStatus.Canceled,
];

export const getOrderStatusText = (val?: number) => {
  return getObjectText(OrderStatus, val);
};

// export const Platforms = [
//   'mobile-ios',
//   'mobile-android',
//   'desktop-windows',
//   'desktop-macos',
//   // 'desktop-linux',
//   //'tvbox-android',
// ];

export const Platform = {
  MobileIos: { label: 'mobile-ios', value: 'mobile-ios' },
  MobileAndroid: { label: 'mobile-android', value: 'mobile-android' },
  DesktopWindows: { label: 'desktop-windows', value: 'desktop-windows' },
  DesktopMacOs: { label: 'desktop-macos', value: 'desktop-macos' },
};

export const PlatformOptions = [
  Platform.MobileIos,
  Platform.MobileAndroid,
  Platform.DesktopWindows,
  Platform.DesktopMacOs,
];

//export const Channels = ['apple', 'google', 'universal'];
export const Channels = [
  { label: 'apple', value: 'apple' },
  { label: 'google', value: 'google' },
  { label: 'universal', value: 'universal' },
];

export const PlatformChannels = {
  'mobile-ios': ['apple'],
  'mobile-android': ['google', 'universal'],
  'desktop-windows': ['universal'],
  'desktop-macos': ['apple'],
  // 'desktop-linux': ['universal'],
  // 'tvbox-android': ['universal'],
};

//购买渠道
export const PurchaseChannel = {
  AppStore: { label: 'AppStore', value: 'appstore' },
  GooglePlay: { label: 'GooglePlay', value: 'googleplay' },
  Portal: { label: '官网', value: 'portal' },
  Agent: { label: '代理', value: 'agent' },
  AuthCode: { label: '授权码', value: 'authcode' },
  PMP: { label: 'PMP', value: 'pmp' },
};

export const PurchaseChannelAllOptions = [
  PurchaseChannel.AppStore,
  PurchaseChannel.GooglePlay,
  PurchaseChannel.Portal,
  PurchaseChannel.Agent,
  PurchaseChannel.AuthCode,
  PurchaseChannel.PMP,
];

export const PurchaseChannelSetOptions = [
  PurchaseChannel.AppStore,
  PurchaseChannel.GooglePlay,
  PurchaseChannel.Portal,
  // PurchaseChannel.Agent,
  // PurchaseChannel.AuthCode,
  PurchaseChannel.PMP,
];

export const getPurchaseChannelText = (val?: string) => {
  return getObjectText(PurchaseChannel, val);
};

//广告策略版本比较
export const AdPolicyAppVerCompareOptions = [
  { label: '', value: '' },
  AppVerCompare.Equals,
  AppVerCompare.GreaterThan,
  AppVerCompare.GreaterThanOrEqual,
  AppVerCompare.LessThan,
  AppVerCompare.LessThanOrEqual,
];

//广告平台
export const AdPlatform = {
  AdMob: { label: 'AdMob', value: 'admob' },
  TopOn: { label: 'TopOn', value: 'topOn' },
  Self: { label: '直客', value: 'self' },
};

export const AdPlatformOptions = [
  AdPlatform.AdMob,
  AdPlatform.TopOn,
  AdPlatform.Self,
];

export const getAdPlatformText = (val?: string) => {
  return getObjectText(AdPlatform, val);
};

//广告类型
export const AdType = {
  AppOpen: { label: '开屏', value: 'appOpen' },
  Interstitial: { label: '插屏', value: 'interstitial' },
  Banner: { label: '横幅', value: 'banner' },
  Native: { label: '原生', value: 'native' },
  Floating: { label: '浮动', value: 'floating' },
};

export const AdTypeOptions = [
  AdType.AppOpen,
  AdType.Interstitial,
  AdType.Banner,
  AdType.Native,
  AdType.Floating,
];

export const getAdTypeText = (val?: string) => {
  return getObjectText(AdType, val);
};

export const AdPlatformTypes = {
  admob: [AdType.AppOpen, AdType.Interstitial, AdType.Banner, AdType.Native],
  topOn: [AdType.AppOpen, AdType.Interstitial, AdType.Banner],
  self: [AdType.AppOpen, AdType.Interstitial, AdType.Banner, AdType.Floating],
};

//AdMob广告位置
export const AdMobSlot = {
  AppOpen: { label: '开屏', value: 'appOpen' },
  ConnectInterstitial: { label: '连接插屏', value: 'connectInterstitial' },
  Home: { label: 'Home页', value: 'home' },
  Location: { label: '分组列表页', value: 'location' },
  Connect: { label: '连接等待页', value: 'connect' },
  System: { label: '系统菜单页', value: 'system' },
};

export const AdMobTypeSlots = {
  appOpen: [AdMobSlot.AppOpen],
  interstitial: [AdMobSlot.ConnectInterstitial],
  banner: [AdMobSlot.Home],
  native: [
    AdMobSlot.Home,
    AdMobSlot.Location,
    AdMobSlot.Connect,
    AdMobSlot.System,
  ],
};

export const getAdMobSlotText = (val?: string) => {
  return getObjectText(AdMobSlot, val);
};

//原生广告尺寸
export const AdMobNaviteSize = {
  Small: { label: '小', value: '0' },
  Medium: { label: '中', value: '1' },
};

export const AdMobNaviteSizeOptions = [
  AdMobNaviteSize.Small,
  AdMobNaviteSize.Medium,
];

export const getAdMobNaviteSizeText = (val?: string) => {
  return getObjectText(AdMobNaviteSize, val);
};

//TopOn广告位置
export const AdTopOnSlots = {
  interstitial: [
    { label: '位置-1', value: '1' },
    { label: '位置-2', value: '2' },
  ],
  banner: [{ label: '位置-1', value: '1' }],
};

export const ServerTypes = [
  { text: '物理机', label: '物理机', value: 1 },
  { text: '虚拟机', label: '虚拟机', value: 2 },
];

export const GrafanaHours = [
  { label: '1小时', value: 'now-1h', interval: '15s' },
  { label: '2小时', value: 'now-2h', interval: '30s' },
  { label: '4小时', value: 'now-4h', interval: '60s' },
  { label: '6小时', value: 'now-6h', interval: '90s' },
  { label: '12小时', value: 'now-12h', interval: '3m' },
  { label: '24小时', value: 'now-24h', interval: '6m' },
  { label: '48小时', value: 'now-48h', interval: '12m' },
  { label: '72小时', value: 'now-72h', interval: '18m' },
  { label: '7天', value: 'now-7d', interval: '42m' },
  { label: '30天', value: 'now-30d', interval: '180m' },
  { label: '60天', value: 'now-60d', interval: '360m' },
  { label: '90天', value: 'now-90d', interval: '540m' },
];
export const GrafanaStatHours = [
  { label: '1小时', value: 'now-1h' },
  { label: '6小时', value: 'now-6h' },
  { label: '12小时', value: 'now-12h' },
  { label: '24小时', value: 'now-24h' },
  { label: '2天', value: 'now-2d' },
  { label: '3天', value: 'now-3d' },
  { label: '7天', value: 'now-7d' },
  { label: '10天', value: 'now-10d' },
  { label: '15天', value: 'now-15d' },
  { label: '30天', value: 'now-30d' },
];
export const GrafanaStatInterval = [
  { label: '1分钟', value: '1m' },
  { label: '3分钟', value: '3m' },
  { label: '5分钟', value: '5m' },
  { label: '10分钟', value: '10m' },
  { label: '15分钟', value: '15m' },
  { label: '30分钟', value: '30m' },
  { label: '60分钟', value: '60m' },
  { label: '120分钟', value: '120m' },
];

export const RouteTypes = [
  { label: 'Center', value: 1 },
  { label: 'Route', value: 2 },
  { label: 'CDN', value: 3 },
  { label: 'Auth', value: 4 },
  { label: 'API', value: 10 },
  { label: 'DAS', value: 11 },
  { label: 'PMP', value: 12 },
  { label: 'DB', value: 13 },
];
export const TicketStatusOptions = [
  { label: '待处理', value: 0 },
  { label: '处理中', value: 1 },
  { label: '关闭', value: 2 },
  { label: '完成', value: 5 },
];
export const VpnGroupProtocols = [
  { label: 'TCP', value: 1 },
  { label: 'UDP', value: 2 },
  { label: 'TCP&UDP', value: 3 },
];
export const ServerDeployTypes = [
  { label: '全新安装', value: 'new_install' },
  { label: '初始化', value: 'init' },
  { label: '创建YML', value: 'createyml' },
  { label: '安装', value: 'install' },
  { label: '更新', value: 'update' },
  { label: '卸载', value: 'uninstall' },
];

export const getServerType = (value?: number) => {
  if (!value) {
    return undefined;
  }
  for (let item of ServerTypes) {
    if (item.value === value) {
      return item;
    }
  }
  return undefined;
};

// export const ServerDeployServerTypes = {
//   Vpn: { label: 'VPN服务器', value: 1 },
//   XVpn: { label: '节点服务器', value: 2 },
// };
export const ServerDeployServerTypeOptions = [
  { label: 'VPN服务器', value: 1 },
  { label: '节点服务器', value: 2 },
];

export const SubscribeType = {
  Subscribe: 'subscribe',
  Checkout: 'checkout',
  AuthCode: 'authcode',
};

export const getIpArea = (data: API.IpArea) => {
  let info = '';
  if (data.ipCountry == '中国') {
    info += `${data.ipCountry ?? ''} ${data.ipProvince ?? ''} ${
      data.ipCity ?? ''
    }`;
    if (data.ipNet && data.ipNet != '' && data.ipNet.indexOf('内网') == -1) {
      info += ` [${data.ipNet}]`;
    }
  } else {
    info = data.ipCountry ?? '';
  }

  return info;
};

export const AreaGroup = {
  ChinaMainland: { label: '中国大陆', value: '中国大陆' },
  ChinaHK: { label: '中国香港', value: '中国香港' },
  ChinaMO: { label: '中国澳门', value: '中国澳门' },
  ChinaTW: { label: '中国台湾', value: '中国台湾' },
  Foreign: { label: '海外地区', value: '海外地区' },
};

export const AreaGroupOptions = [AreaGroup.ChinaMainland, AreaGroup.Foreign];

export const ForeignCountrys = [
  '伊朗',
  '印度',
  '美国',
  '法国',
  '德国',
  '英国',
  '加拿大',
  '荷兰',
  '芬兰',
  '俄罗斯联邦',
  '波兰',
  '土耳其',
  '伊拉克',
  '阿联酋',
  '沙特阿拉伯',
  '阿富汗',
  '新加坡',
  '缅甸',
  '日本',
  '澳大利亚',
  '巴基斯坦',
  '西班牙',
  '瑞典',
  '也门',
  '厄立特里亚',
  '印度尼西亚',
  '孟加拉国',
  '韩国',
  '罗马尼亚',
  '瑞士',
  '卡塔尔',
  '乌克兰',
  '阿曼',
  '爱尔兰',
  '巴林',
  '摩尔多瓦',
  '爱沙尼亚',
  '立陶宛',
  '捷克',
  '南非',
  '巴西',
  '奥地利',
  '保加利亚',
  '约旦',
  '意大利',
  '马来西亚',
  '埃及',
  '尼日利亚',
  '中国',
  '新西兰',
  '科威特',
  '卢森堡',
  '叙利亚',
  '埃塞俄比亚',
  '乌兹别克斯坦',
  '阿塞拜疆',
  '挪威',
  '尼泊尔',
  '拉脱维亚',
  '菲律宾',
  '比利时',
  '哈萨克斯坦',
  '亚美尼亚',
  '泰国',
  '坦桑尼亚',
  '以色列',
  '阿尔及利亚',
  '葡萄牙',
  '丹麦',
  '越南',
  '匈牙利',
  '墨西哥',
  '塞浦路斯',
  '古巴',
  '塔吉克斯坦',
  '加纳',
  '格鲁吉亚',
  '摩洛哥',
  '黎巴嫩',
  '苏丹',
  '巴拿马',
  '斯洛伐克',
  '塞尔维亚',
  '白俄罗斯',
  '乌干达',
  '希腊',
  '冰岛',
  '克罗地亚',
  '贝宁',
  '塞舌尔',
  '利比亚',
  '阿尔巴尼亚',
  '索马里',
  '斯里兰卡',
  '肯尼亚',
  '伯利兹',
  '英国属地曼岛',
  '哥伦比亚',
  '突尼斯',
  '柬埔寨',
  '象牙海岸',
  '委内瑞拉',
  '阿根廷',
  '巴勒斯坦',
  '英属维尔京群岛',
  '智利',
  '吉尔吉斯斯坦',
  '吉布提',
  '秘鲁',
  '前南马其顿',
  '不丹',
  '蒙古',
  '喀麦隆',
  '多哥',
  '多米尼加',
  '扎伊尔',
  '斯洛文尼亚',
  '直布罗陀',
  '毛里求斯',
  '波黑',
  '特立尼达和多巴哥',
  '危地马拉',
  '哥斯达黎加',
  '马里',
  '塞内加尔',
  '安道尔',
  '牙买加',
  '乌拉圭',
  '塞拉利昂',
  '老挝',
  '赞比亚',
  '马尔代夫',
  '南苏丹',
  '厄瓜多尔',
  '莫桑比克',
  '赤道几内亚',
  '马耳他',
  '土库曼斯坦',
  '巴布亚新几内亚',
  '萨尔瓦多',
  '马达加斯加',
  '几内亚',
  '布基纳法索',
  '文莱',
  '津巴布韦',
  '玻利维亚',
  '圣卢西亚',
  '圭亚那',
  '巴拉圭',
  '卢旺达',
  '尼日尔',
  '巴哈马',
  '巴巴多斯',
  '格陵兰',
  '纳米比亚',
  '黑山',
  '东帝汶',
  '加蓬',
  '安哥拉',
  '尼加拉瓜',
  '摩纳哥',
  '斯威士兰',
  '波多黎各',
  '泽西岛',
  '洪都拉斯',
  '科索沃',
  '关岛',
  '冈比亚',
  '列支敦士登',
  '刚果共和国',
  '博茨瓦纳',
  '圣文森特和格林纳丁斯',
  '安提瓜和巴布达',
  '库拉索',
  '斐济',
  '根西岛',
  '格林纳达',
  '毛利塔尼亚',
  '法属圭亚那',
  '法属波利尼西亚',
  '海地',
  '留尼汪',
  '科摩罗',
  '苏里南',
  '马拉维',
  '马提尼克',
]; //'俄罗斯联邦' ,'土耳其'

export const getAllAreas = (includeEmpty: boolean) => {
  let options = [];
  if (includeEmpty === true) {
    options.push(DefaultOptionEmpty);
  }
  options.push(AreaGroup.ChinaMainland);

  for (let [_, item] of Object.entries(ForeignCountrys)) {
    options.push({
      label: item,
      value: item,
    });
  }

  return options;
};

export const getAreaGroupCountrys = (areaGroup: string) => {
  if (areaGroup === AreaGroup.ChinaMainland.value) {
    return [];
  } else if (areaGroup === AreaGroup.ChinaHK.value) {
    return [];
  } else if (areaGroup === AreaGroup.ChinaMO.value) {
    return [];
  } else if (areaGroup === AreaGroup.ChinaTW.value) {
    return [];
  } else if (areaGroup === AreaGroup.Foreign.value) {
    return ForeignCountrys;
  }

  return [];
};

export const Countrys = [
  '伊朗',
  '印度',
  '美国',
  '法国',
  '德国',
  '英国',
  '加拿大',
  '荷兰',
  '芬兰',
  '俄罗斯联邦',
  '波兰',
  '土耳其',
  '伊拉克',
  '阿联酋',
  '沙特阿拉伯',
  '阿富汗',
  '新加坡',
  '缅甸',
  '日本',
  '澳大利亚',
  '巴基斯坦',
  '西班牙',
  '瑞典',
  '也门',
  '厄立特里亚',
  '印度尼西亚',
  '孟加拉国',
  '韩国',
  '罗马尼亚',
  '瑞士',
  '卡塔尔',
  '乌克兰',
  '阿曼',
  '爱尔兰',
  '巴林',
  '摩尔多瓦',
  '爱沙尼亚',
  '立陶宛',
  '捷克',
  '南非',
  '巴西',
  '奥地利',
  '保加利亚',
  '约旦',
  '意大利',
  '马来西亚',
  '埃及',
  '尼日利亚',
  '中国',
  '新西兰',
  '科威特',
  '卢森堡',
  '叙利亚',
  '埃塞俄比亚',
  '乌兹别克斯坦',
  '阿塞拜疆',
  '挪威',
  '尼泊尔',
  '拉脱维亚',
  '菲律宾',
  '比利时',
  '哈萨克斯坦',
  '亚美尼亚',
  '泰国',
  '坦桑尼亚',
  '以色列',
  '阿尔及利亚',
  '葡萄牙',
  '丹麦',
  '越南',
  '匈牙利',
  '墨西哥',
  '塞浦路斯',
  '古巴',
  '塔吉克斯坦',
  '加纳',
  '格鲁吉亚',
  '摩洛哥',
  '黎巴嫩',
  '苏丹',
  '巴拿马',
  '斯洛伐克',
  '塞尔维亚',
  '白俄罗斯',
  '乌干达',
  '希腊',
  '冰岛',
  '克罗地亚',
  '贝宁',
  '塞舌尔',
  '利比亚',
  '阿尔巴尼亚',
  '索马里',
  '斯里兰卡',
  '肯尼亚',
  '伯利兹',
  '英国属地曼岛',
  '哥伦比亚',
  '突尼斯',
  '柬埔寨',
  '象牙海岸',
  '委内瑞拉',
  '阿根廷',
  '巴勒斯坦',
  '英属维尔京群岛',
  '智利',
  '吉尔吉斯斯坦',
  '吉布提',
  '秘鲁',
  '前南马其顿',
  '不丹',
  '蒙古',
  '喀麦隆',
  '多哥',
  '多米尼加',
  '扎伊尔',
  '斯洛文尼亚',
  '直布罗陀',
  '毛里求斯',
  '波黑',
  '特立尼达和多巴哥',
  '危地马拉',
  '哥斯达黎加',
  '马里',
  '塞内加尔',
  '安道尔',
  '牙买加',
  '乌拉圭',
  '塞拉利昂',
  '老挝',
  '赞比亚',
  '马尔代夫',
  '南苏丹',
  '厄瓜多尔',
  '莫桑比克',
  '赤道几内亚',
  '马耳他',
  '土库曼斯坦',
  '巴布亚新几内亚',
  '萨尔瓦多',
  '马达加斯加',
  '几内亚',
  '布基纳法索',
  '文莱',
  '津巴布韦',
  '玻利维亚',
  '圣卢西亚',
  '圭亚那',
  '巴拉圭',
  '卢旺达',
  '尼日尔',
  '巴哈马',
  '巴巴多斯',
  '格陵兰',
  '纳米比亚',
  '黑山',
  '东帝汶',
  '加蓬',
  '安哥拉',
  '尼加拉瓜',
  '摩纳哥',
  '斯威士兰',
  '波多黎各',
  '泽西岛',
  '洪都拉斯',
  '科索沃',
  '关岛',
  '冈比亚',
  '列支敦士登',
  '刚果共和国',
  '博茨瓦纳',
  '圣文森特和格林纳丁斯',
  '安提瓜和巴布达',
  '库拉索',
  '斐济',
  '根西岛',
  '格林纳达',
  '毛利塔尼亚',
  '法属圭亚那',
  '法属波利尼西亚',
  '海地',
  '留尼汪',
  '科摩罗',
  '苏里南',
  '马拉维',
  '马提尼克',
  '未知地区',
];

export const NodeTemplateConfigType = {
  Http: { label: 'Http', value: 1 },
  Https: { label: 'Https', value: 2 },
  Vision: { label: 'Vision', value: 3 },
  Realtity: { label: 'Reality', value: 4 },
  CdnWss: { label: 'CDN_Wss', value: 5 },
};
export const NodeTemplateConfigTypeOptions = [
  NodeTemplateConfigType.Http,
  NodeTemplateConfigType.Https,
  NodeTemplateConfigType.Vision,
  NodeTemplateConfigType.Realtity,
  NodeTemplateConfigType.CdnWss,
];

export const LogLevel = ['debug', 'info', 'warning', 'error', 'none'];

export const NodeRouterType = ['xrouter', 'xapi', 'xdas'];

export const NodeChannelType = {
  Node: { label: '直连', value: 1 },
  Bridge: { label: '桥接', value: 2 },
};
export const NodeChannelTypeOptions = [
  NodeChannelType.Node,
  NodeChannelType.Bridge,
];

export const NodeType = {
  Node: { label: '直连节点', value: 1 },
  Cdn: { label: 'CDN节点', value: 2 },
  Bridge: { label: '桥接节点', value: 3 },
};

export const NodeTypeOptions = [NodeType.Node, NodeType.Cdn, NodeType.Bridge];

export const EtcdRunStatus = {
  Ready: 'ready',
  Failed: 'failed',
};

export const TernaryEnableState = [
  { label: ' ', value: -1 },
  { label: '启用', value: 1 },
  { label: '禁用', value: 0 },
];

export const UserConfigSmartMode = [
  { label: ' ', value: -1 },
  { label: '启用', value: 1 },
  { label: '禁用', value: 0 },
];

export const UserConfigLogLevel = ['none', 'basic', 'detailed', 'all'];

export const CheckJob = {
  // CheckNode: { label: '检测节点', value: 'checknode' },
  // SpeedTest: { label: '测速', value: 'speedtest' },
  CheckApi: { label: '检测域名', value: 'checkapi' },
  Ping: { label: 'Ping', value: 'ping' },
  TraceRoute: { label: 'Trace Route', value: 'traceroute' },
  HttpPost: { label: 'Http Post', value: 'httppost' },
};

export const CheckJobAllOptions = [
  // CheckJob.CheckNode,
  // CheckJob.SpeedTest,
  CheckJob.CheckApi,
  CheckJob.Ping,
  CheckJob.TraceRoute,
  CheckJob.HttpPost,
];
// export const CheckJobOptions = [CheckJob.CheckNode, CheckJob.SpeedTest];
export const CheckJobManualOptions = [
  CheckJob.Ping,
  CheckJob.TraceRoute,
  CheckJob.HttpPost,
  CheckJob.CheckApi,
];
export const CheckJobAutoOptions = [
  CheckJob.HttpPost,
  // CheckJob.CheckApi,
];
export const CheckMode = {
  Simple: { label: '快速检测', value: 'simple' },
  Detailed: { label: '详细检测', value: 'detailed' },
};
export const CheckModeOptions = [CheckMode.Simple, CheckMode.Detailed];
export const CheckLevel = {
  Normal: { label: '正常检测', value: 1 },
  Urgent: { label: '紧急检测', value: 10 },
};
export const CheckLevelOptions = [CheckLevel.Normal, CheckLevel.Urgent];
export const CheckTaskStatus = {
  Unpublish: { label: '待发布', value: 0 },
  Wait: { label: '待检测', value: 1 },
  Run: { label: '检测中', value: 2 },
  Completed: { label: '完成', value: 3 },
  Cancel: { label: '取消', value: 4 },
  Timeout: { label: '超时', value: 5 },
};
export const CheckTaskStatusOptions = [
  CheckTaskStatus.Unpublish,
  CheckTaskStatus.Wait,
  CheckTaskStatus.Run,
  CheckTaskStatus.Completed,
  CheckTaskStatus.Cancel,
  CheckTaskStatus.Timeout,
];
export const CheckTaskItemStatus = {
  Normal: { label: '仅启用', value: -1 },
  All: { label: '启用及禁用', value: 1 },
  Disable: { label: '仅禁用', value: 2 },
};
export const CheckTaskItemStatusOptions = [
  CheckTaskItemStatus.Normal,
  CheckTaskItemStatus.All,
  CheckTaskItemStatus.Disable,
];
export const CheckScheduleLogStatus = {
  Error: { label: '出错', value: 0 },
  Completed: { label: '完成', value: 1 },
  Run: { label: '处理中', value: 2 },
  Timeout: { label: '超时', value: 5 },
};
export const CheckScheduleStatusOptions = [
  CheckScheduleLogStatus.Error,
  CheckScheduleLogStatus.Completed,
  CheckScheduleLogStatus.Run,
  CheckScheduleLogStatus.Timeout,
];

export const IdcOrderType = {
  PublicCloud: { label: '公有云', value: 1 },
};
export const IdcOrderTypeOptions = [IdcOrderType.PublicCloud];
export const IdcOrderStatus = {
  Pending: { label: '待处理', value: 0 },
  Processing: { label: '处理中', value: 1 },
  Done: { label: '完成', value: 2 },
  Error: { label: '出错', value: 3 },
  Close: { label: '关闭', value: 4 },
};
export const IdcOrderStatusOptions = [
  IdcOrderStatus.Pending,
  IdcOrderStatus.Processing,
  IdcOrderStatus.Done,
  IdcOrderStatus.Error,
  IdcOrderStatus.Close,
];
export const IdcServerStatus = {
  Pending: { label: '待开通', value: 0 },
  Processing: { label: '开通中', value: 1 },
  Complate: { label: '开通成功', value: 2 },
  Error: { label: '出错', value: 3 },
  Delete: { label: '删除', value: 4 },
};
export const IdcServerStatusOptions = [
  IdcServerStatus.Pending,
  IdcServerStatus.Processing,
  IdcServerStatus.Complate,
  IdcServerStatus.Error,
  IdcServerStatus.Delete,
];
export const DeployStatus = {
  Run: { label: '处理中', value: 0 },
  Complated: { label: '成功', value: 1 },
  Error: { label: '出错', value: 2 },
};
export const DeployStatusOptions = [
  DeployStatus.Run,
  DeployStatus.Complated,
  DeployStatus.Error,
];
export const DeployLogStatus = {
  Run: { label: '处理中', value: 0 },
  Complated: { label: '成功', value: 1 },
  Error: { label: '出错', value: 2 },
  Timeout: { label: '超时', value: 3 },
};
export const DeployLogStatusOptions = [
  DeployLogStatus.Run,
  DeployLogStatus.Complated,
  DeployLogStatus.Error,
  DeployLogStatus.Timeout,
];
export const DeployType = {
  Install: { label: '安装', value: 1 },
  Update: { label: '更新', value: 2 },
  Uninstall: { label: '卸载', value: 3 },
  Reload: { label: '重加载', value: 4 },
  Restart: { label: '重启', value: 5 },
  Init: { label: '初始化', value: 6 },
  Ping: { label: '连通检测', value: 7 },
};
export const DeployTypeOptions = [
  DeployType.Install,
  DeployType.Update,
  DeployType.Uninstall,
  DeployType.Reload,
  DeployType.Restart,
  DeployType.Init,
  DeployType.Ping,
];

// export const IdcApiEventType = {
//   Oracle: { label: 'Oracle', value: 'oracle' },
//   AwsDhan1: { label: 'AwsDhan1', value: 'aws_dhan_1' },
//   AwsDhan2: { label: 'AwsDhan2', value: 'aws_dhan_2' },
// };
// export const IdcApiEventTypeOptions = [
//   IdcApiEventType.Oracle,
//   IdcApiEventType.AwsDhan1,
//   IdcApiEventType.AwsDhan2,
// ];
export const IdcApiEventAction = {
  ChangeIp: { label: '更换IP', value: 1 },
  // Reboot: { label: '重启', value: 2 },
};
export const IdcApiEventActionOptions = [IdcApiEventAction.ChangeIp];
export const IdcApiEventStatus = {
  待处理: { label: '待处理', value: 0 },
  处理中: { label: '处理中', value: 1 },
  待同步IP: { label: '待同步IP', value: 2 },
  完成: { label: '完成', value: 3 },
  出错: { label: '出错', value: 4 },
  同步IP出错: { label: '同步IP出错', value: 5 },
};
export const IdcApiEventStatusOptions = [
  IdcApiEventStatus.待处理,
  IdcApiEventStatus.处理中,
  IdcApiEventStatus.待同步IP,
  IdcApiEventStatus.完成,
  IdcApiEventStatus.出错,
  IdcApiEventStatus.同步IP出错,
];
export const ChangeIpStatus = {
  更换中: { label: '更换中', value: 1 },
  成功: { label: '成功', value: 2 },
  失败: { label: '失败', value: 3 },
  重新更换: { label: '重新更换', value: 4 },
};
export const ChangeIpStatusOptions = [
  ChangeIpStatus.更换中,
  ChangeIpStatus.成功,
  ChangeIpStatus.失败,
  ChangeIpStatus.重新更换,
];
export const IspFilterPolicy = {
  Whitelist: { label: '运营商白名单', value: 'whitelist' },
  Blacklist: { label: '运营商黑名单', value: 'blacklist' },
};

export const IspFilterPolicyOptions = [
  { label: '', value: '' },
  IspFilterPolicy.Whitelist,
  IspFilterPolicy.Blacklist,
];

export const CdnSupplierType = {
  Cloudflare: { label: 'Cloudflare', value: 1 },
};
export const CdnSupplierTypeOptions = [
  CdnSupplierType.Cloudflare,
];
export const CheaterType = {
  TcpCheaterDisable: { label: 'TCP_CHEATER_DISABLE', value: 0 },
  TcpCheaterHttp: { label: 'TCP_CHEATER_HTTP', value: 1 },
  TcpCheaterHttp1: { label: 'TCP_CHEATER_HTTP1', value: 2 },
  TcpCheaterObf: { label: 'TCP_CHEATER_OBF', value: 3 },
  TcpCheaterHttps: { label: 'TCP_CHEATER_HTTPS', value: 4 },
  TcpCheaterHttp2: { label: 'TCP_CHEATER_HTTP2', value: 5 },
  TcpCheaterCdn: { label: 'TCP_CHEATER_CDN', value: 6 },
};
export const CheaterTypeOptions = [
  CheaterType.TcpCheaterDisable,
  CheaterType.TcpCheaterHttp,
  CheaterType.TcpCheaterHttp1,
  CheaterType.TcpCheaterObf,
  CheaterType.TcpCheaterHttps,
  CheaterType.TcpCheaterHttp2,
  CheaterType.TcpCheaterCdn,
];